<?xml version="1.0" encoding="UTF-8" ?>

<!-- =======================================================================
 Examples of typical SourceMonitor command line script commands.
======================================================================== -->

<sourcemonitor_commands>

    <!-- ===================================================================
     The write_log element value is used for execution of commands in this
     file, not the log errors flag set in SourceMonitor's options dialog.
     If this element is missing, command progress and errors will be written
     to the SourceMonitor log file.
     =================================================================== -->

    <write_log>true</write_log>

    <!-- ===============================================================
      This command is typical for a project that does not yet exist.
      The file name becomes the project name of the new project.
    ================================================================ -->

    <command>

        <project_file>C:\Projects\MyProject\src\MyProject.smp</project_file>

        <!-- ===============================================================
         For a new project, you must specify the language and the location
         of the source code.
        ================================================================ -->

        <project_language>C++</project_language>
        <source_directory>C:\Projects\MyProject\src</source_directory>

        <!-- ===============================================================
         If the optional flag element, "exclude_subdirectories", is "true"
         then the listed subdirectories are NOT.to be included in the
         project (all other subdirectories WILL be included). If this flag
         element is missing or "false" then only the subdirectories listed
         will be included in the project. The "source_subtree" element
         identifies the parent of a subdirectory tree, all of which will be
         included/excluded. Element "source_subdirectory" applies to a
         single directory and not its children (if any).
        ================================================================ -->

        <source_subdirectory_list>
            <exclude_subdirectories>true</exclude_subdirectories>
            <source_subtree>bin\</source_subtree>
            <source_subdirectory>obj\</source_subdirectory>
        </source_subdirectory_list>

        <parse_utf8_files>True</parse_utf8_files>
      
        <checkpoint_name>Baseline</checkpoint_name>
        <checkpoint_date>1999-08-31T12:24:56</checkpoint_date>

        <!-- ===============================================================
         For either a new or existing project, you can override the default
         or current file extensions (set in the Options dialog) for source
         files to be included in a new checkpoint. All files with the
         extensions you specify here will be included in the new checkpoint.
        ================================================================ -->

        <file_extensions>*.h,*.cpp</file_extensions>
        <include_subdirectories>true</include_subdirectories>

        <!-- ===============================================================
         If you are creating a project that counts DOC comments separately, then you
         can provide a number in the following element to specify the kind of
         comments to ignore at the beginning and end of each source file:
         1 => normal comments only
         2 => DOC comments only
         3 => both normal and DOC comments
         For example,
        ================================================================ -->
         <ignore_headers_footers>2 DOC only</ignore_headers_footers>.

        <!-- ===============================================================
         For projects that don't count DOC comments, just set this element to
         true or false:
        ================================================================ -->
        <ignore_headers_footers>True</ignore_headers_footers>

        <!-- ===============================================================
         Export of metrics data is supported for a single checkpoint per
         command (the one identified in the <checkpoint_name> tag or one that
         is automatically created as explained below). Exported metrics data
         is specified by the export type: "1" for the project summary as XML,
         "2" for checkpoint details as XML, or "3" project details as CSV.
         You specify the type with a number 1, 2 or 3 in the element's
         contents. All other text is ignored. The following examples are
         all valid specification of export type 2:
           <export_type>2 (project details as XML)</export_type>
           <export_type>Project details as XML: 2</export_type>
           <export_type>2</export_type>
        ================================================================ -->

        <export>
            <export_insert>xml-stylesheet type='text/xsl' href='SourceMonitor.xslt'</export_insert>
            <export_file>C:\Projects\dump.xml</export_file>
            <export_type>1 (project summary as XML)</export_type>
        </export>

        <!-- ===============================================================
         When the </command> tag is encountered, the command specified above
         is executed. In this sample command, the project and checkpoint are
         created and the XML export file is generated.
        ================================================================ -->

    </command>

    <!-- ===============================================================
     This command is typical for the case where a project exists and you
     want to create a new checkpoint and export its metrics.
    ================================================================ -->

    <command>

        <project_file>C:\Projects\MyProject\src\MyProject.smp</project_file>

        <!-- ===============================================================
         If you do not specify a checkpoint name, a name will be created for
         you in the form "CheckpointN" where N is the next higher number not
         already present in an auto-generated checkpoint name in this
         project.
        ================================================================ -->

        <export>
            <export_file>C:\Projects\dump.xml</export_file>
            <export_type>2 (checkpoint details as XML)</export_type>
        </export>

        <!-- ===============================================================
          If you wish, you can delete the checkpoint you just created.
        ================================================================ -->

        <delete_checkpoint />

        <!-- ===============================================================
         When the </command> tag is encountered, the checkpoint is created,
         the metrics for all files in the new checkpoint are exported as
         XML, and then the new checkpoint is deleted from the project.
         However, if any errors occur in the command's specification, an
         error message will be logged (if logging is enabled) and the
         execution of the command will be aborted.
        ================================================================ -->

    </command>

    <!-- ===============================================================
      This command is typical for the case where a project and
      checkpoint both already exist, and all you want to do is export
      the metrics for the checkpoint.
    ================================================================ -->

    <command>

        <project_file>C:\Projects\MyProject\src\MyProject.smp</project_file>
        <checkpoint_name>Alpha One</checkpoint_name>
        <export>
            <export_file>C:\Projects\dump.txt</export_file>
            <export_type>3 (project details as CSV)</export_type>
        </export>
    </command>

    <!-- ===============================================================
      This command is typical for the case where a project already exists 
      and you want to export all checkpoints in the project with percent
      values and method metrics.
    ================================================================ -->

    <command>

        <project_file>C:\Projects\MyProject\src\MyProject.smp</project_file>
        <export>
            <export_file>C:\Projects\dump.txt</export_file>
            <export_type>2 (project details as XML)</export_type>
            <export_option>Include method metrics: option 3</export_option>
            <export_all_checkpoints />
        </export>
    </command>
</sourcemonitor_commands>
